//
//  SpUserItem.m
//  IphoneMapSdkDemo
//
//  Created by sunmingming on 14-4-22.
//  Copyright (c) 2014年 Baidu. All rights reserved.
//

#import "SpUserItem.h"

@implementation SpUserItem

//重载选择 使用的LKDBHelper
+(LKDBHelper *)getUsingLKDBHelper
{
    static LKDBHelper* db;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
//                NSString* dbpath = [NSHomeDirectory() stringByAppendingPathComponent:@"asd/asd.db"];
//        NSLog(@"%@",dbpath);
        //        db = [[LKDBHelper alloc]initWithDBPath:dbpath];
        //or
        db = [[LKDBHelper alloc]init];
    });
    return db;
}

- (id)initWithDictionary:(NSDictionary *)dictionary
{
    if (self = [self init])
    {
        self.username = [dictionary valueForKey:@"username"];
        self.password = [dictionary valueForKey:@"password"];
        self.age = [dictionary valueForKey:@"age"];
        self.height = [dictionary valueForKey:@"height"];
        self.nickname = [dictionary valueForKey:@"nickname"];
        self.phone = [dictionary valueForKey:@"phone"];
        self.qq = [dictionary valueForKey:@"qq"];
        self.weibo = [dictionary valueForKey:@"weibo"];
        self.weight = [dictionary valueForKey:@"weight"];
        self.weixin = [dictionary valueForKey:@"weixin"];
    }
    return self;
}

-(id)init
{
    if(self = [super init])
    {
        self.spID = 1;
        self.username = @"";
        self.password = @"";
        self.age = @"";
        self.height = @"";
        self.nickname = @"";
        self.phone = @"";
        self.qq = @"";
        self.weibo = @"";
        self.weight = @"";
        self.weixin = @"";
    }
    return self;
}

//在类 初始化的时候
+(void)initialize
{
    //enable the column binding property name
    //[self setTableColumnName:@"id" bindingPropertyName:@"dbid"];
}

//主键
+(NSString *)getPrimaryKey
{
    return @"spID";
}

//表名
+(NSString *)getTableName
{
    return @"sp_user";
}

@end
